![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
transformime-react
Advanced tools
Transforms MIMEtype+data to pure React Elements.
npm install transformime-react
Note that react
and immutable
are peer dependencies; you'll need to install those as well if they're not in your project (hint: they're definitely needed to make this package useful at all).
npm install immutable@3.7.x react@0.14.x
import { richestMimetype, transforms } from 'transformime-react';
import Immutable from 'immutable';
// Jupyter style MIME bundle
const bundle = new Immutable.Map({
'text/plain': 'This is great',
'image/png': 'R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'
});
// Find out which mimetype is the richest
const mimetype = richestMimetype(bundle);
// Get the matching React.Component for that mimetype
let Transform = transforms.get(mimetype);
// Create a React element
return <Transform data={bundle.get(mimetype)} />;
which will return:
<img src='data:image/png;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7' />
as a React element. It chose 'image/png' as richer than 'text/plain' for representation.
const myOrder = Immutable.List(['text/plain', 'image/png']);
const CodeAsText = React.createClass({
render: function() {
return (
<code>{this.props.data}</code>
);
}
});
const myTransforms = transforms.set('text/plain', CodeAsText);
const mimetype = richestMimetype(bundle, myOrder, myTransforms);
Transform = myTransforms.get(mimetype);
return <Transform data={bundle.get(mimetype)} />;
Using the bundle from above, we'll get back:
<code>This is great</code>
FAQs
Transformime that returns React components
The npm package transformime-react receives a total of 13 weekly downloads. As such, transformime-react popularity was classified as not popular.
We found that transformime-react demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.